//package com.cms.demo.controller;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.autoconfigure.web.ErrorProperties;
//import org.springframework.boot.autoconfigure.web.ServerProperties;
//import org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController;
//import org.springframework.boot.autoconfigure.web.servlet.error.ErrorViewResolver;
//import org.springframework.boot.web.servlet.error.ErrorAttributes;
//import org.springframework.http.HttpStatus;
//import org.springframework.http.MediaType;
//import org.springframework.http.ResponseEntity;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.servlet.ModelAndView;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.util.List;
//import java.util.Map;
//
///**
// * @author wangning
// * @create 2021-04-26 17:35
// */
//@Controller
//public class MyErrorController extends BasicErrorController {
//	@Autowired
//	public MyErrorController(ErrorAttributes errorAttributes, ServerProperties serverProperties, List<ErrorViewResolver> errorViewResolvers) {
//		super(errorAttributes, serverProperties.getError(), errorViewResolvers);
//	}
//
//	@Override
//	public ModelAndView errorHtml(HttpServletRequest request, HttpServletResponse response) {
//		HttpStatus status = getStatus(request);
//		Map<String, Object> model = getErrorAttributes(request, isIncludeStackTrace(request, MediaType.TEXT_HTML));
//		model.put("custommsg", "出错了");
//		ModelAndView modelAndView = new ModelAndView("myErrorPage", model, status);
//		return modelAndView;
//	}
//
//	@Override
//	public ResponseEntity<Map<String, Object>> error(HttpServletRequest request) {
//		Map<String, Object> body = getErrorAttributes(request, isIncludeStackTrace(request, MediaType.ALL));
//		body.put("custommsg", "出错了");
//		HttpStatus status = getStatus(request);
//		return new ResponseEntity<>(body, status);
//	}
//}
